package com.wgb.movie.model.vo;

import cn.hutool.json.JSONUtil;
import com.wgb.movie.model.entity.Movie;
import lombok.Data;
import org.springframework.beans.BeanUtils;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * 电影视图
 *
 */
@Data
public class MovieVO implements Serializable {

    /**
     * id
     */
    private Long id;

    /**
     * 影片名称
     */
    private String movieName;

    /**
     * 应用类型（0-喜剧类，1-恐怖类，2-动画类）
     */
    private Integer movieType;

    /**
     * 影片描述
     */
    private String movieDesc;

    /**
     * 上映日期
     */
    private Date releaseDate;

    /**
     * 影片时长（分钟）
     */
    private Integer movieTime;

    /**
     * 海报URL
     */
    private String movieIcon;

    /**
     * 创建时间
     */
    private Date createTime;

    /**
     * 更新时间
     */
    private Date updateTime;

    public static Movie voToObj(MovieVO movieVO) {
        if (movieVO == null) {
            return null;
        }
        Movie movie=new Movie();
        BeanUtils.copyProperties(movieVO, movie);

        return movie;
    }

    public static MovieVO objToVo(Movie movie) {
        if (movie == null) {
            return null;
        }
        MovieVO movieVO=new MovieVO();
        BeanUtils.copyProperties(movie, movieVO);

        return movieVO;
    }
}
